From e0f31705c8f8fb7196a0329b57aebd4f9786c30b Mon Sep 17 00:00:00 2001 From: "dan@elm3b196.beaverton.ibm.com" Date: Fri, 25 Nov 2005 15:17:37 +0000 Subject: [PATCH] Add sanity checks that let us know if there are any problems before we run the entire suite --- tools/xm-test/configure.ac | 1 + tools/xm-test/runtest.sh | 11 ++++++- tools/xm-test/tests/_sanity/01_domu_proc.py | 34 +++++++++++++++++++++ tools/xm-test/tests/_sanity/Makefile.am | 21 +++++++++++++ 4 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 tools/xm-test/tests/_sanity/01_domu_proc.py create mode 100644 tools/xm-test/tests/_sanity/Makefile.am diff --git a/tools/xm-test/configure.ac b/tools/xm-test/configure.ac index 224d5fa129..b2edf49457 100644 --- a/tools/xm-test/configure.ac +++ b/tools/xm-test/configure.ac @@ -35,6 +35,7 @@ AC_CONFIG_FILES([ Makefile ramdisk/Makefile tests/Makefile + tests/_sanity/Makefile tests/block-list/Makefile tests/block-create/Makefile tests/block-destroy/Makefile diff --git a/tools/xm-test/runtest.sh b/tools/xm-test/runtest.sh index f366a48c74..fc124360ea 100755 --- a/tools/xm-test/runtest.sh +++ b/tools/xm-test/runtest.sh @@ -86,6 +86,15 @@ runnable_tests() { exit 1 fi + # Run a few sample tests to make sure things are working + # before we take the plunge + echo "Running sanity checks..." + make -C tests/_sanity check 2>&1 | grep REASON + if [ $? -eq 0 ]; then + echo "Sanity checks failed" + exit 1 + fi + } # Get contact info if needed @@ -119,7 +128,7 @@ get_contact_info() { # Run the tests run_tests() { output=$1 - echo Running tests... + echo Running real tests... TEST_VERBOSE=1 make -k check > $output 2>&1 } diff --git a/tools/xm-test/tests/_sanity/01_domu_proc.py b/tools/xm-test/tests/_sanity/01_domu_proc.py new file mode 100644 index 0000000000..56eb391bed --- /dev/null +++ b/tools/xm-test/tests/_sanity/01_domu_proc.py @@ -0,0 +1,34 @@ +#!/usr/bin/python + +# Copyright (C) International Business Machines Corp., 2005 +# Author: Dan Smith + +# +# Test that the library and ramdisk are working to the point +# that we can start a DomU and read /proc +# + +from XmTestLib import * + +import re + +domain = XmTestDomain() + +try: + domain.start() +except DomainError, e: + FAIL(str(e)) + +try: + console = XmConsole(domain.getName()) + console.sendInput("foo") + run = console.runCmd("cat /proc/cpuinfo") +except ConsoleError, e: + FAIL(str(e)) + +if run["return"] != 0: + FAIL("Unable to read /proc/cpuinfo") + +if not re.search("processor", run["output"]): + print run["output"] + FAIL("/proc/cpuinfo looks wrong!") diff --git a/tools/xm-test/tests/_sanity/Makefile.am b/tools/xm-test/tests/_sanity/Makefile.am new file mode 100644 index 0000000000..c1525b3f44 --- /dev/null +++ b/tools/xm-test/tests/_sanity/Makefile.am @@ -0,0 +1,21 @@ + +SUBDIRS = + +TESTS = 01_domu_proc.test + +XFAIL_TESTS = + +EXTRA_DIST = $(TESTS) $(XFAIL_TESTS) + +TESTS_ENVIRONMENT=@TENV@ + +%.test: %.py + cp $< $@ + chmod +x $@ + +clean-local: am_config_clean-local + +am_config_clean-local: + rm -f *test + rm -f *log + rm -f *~ -- 2.30.2